﻿namespace Framework.Core.Extension
{
	public static class StringExtensions
	{
		/// <summary>
		/// 判断字符串是否为空
		/// </summary>
		/// <param name="value"></param>
		/// <returns></returns>
		public static bool IsEmpty(this object value)
		{
			if (value != null && !string.IsNullOrEmpty(value.ToString()))
			{
				return false;
			}
			else
			{
				return true;
			}
		}

		/// <summary>
		/// 判断字符串是否不为空
		/// </summary>
		/// <param name="value"></param>
		/// <returns></returns>
		public static bool IsNotEmpty(this object value)
		{
			return !IsEmpty(value);
		}

        /// <summary>
		/// 判断字符串是否为空或为0
		/// </summary>
		public static bool IsNullOrZero(this object value)
		{
			if (value == null || value.ToString().Trim() == "0")
			{
				return true;
			}
			else
			{
				return false;
			}
		}
	}
}
